/**
 * 开发者：LuckyMoke
 * Gitee：https://gitee.com/luckymoke/
 * QQ：839488083
 */
! function (h) {
    var g = document,
        m = {
            title: "",
            type: "alert",
            class: "",
            color: "",
            btn: "",
            shadeClose: !1
        },
        e = {
            extend: function (a) {
                var b = JSON.parse(JSON.stringify(m)),
                    c;
                for (c in a) b[c] = a[c];
                return b
            },
            timer: {},
            end: {},
            touch: function (a, b) {
                a.addEventListener("click", function (a) {
                    b.call(this, a)
                }, !1)
            }
        },
        k = 0,
        d = function (a) {
            this.cfg = e.extend(a);
            this.view()
        };
    d.prototype.view = function () {
        var a = "" != this.cfg.color ? ' style="color:' + this.cfg.color + '"' : void 0;
        var b = "string" == typeof this.cfg.btn ? '<div class="lcms-mlayer-alert-btn-bg lcms-mlayer-alert-btn-yes" type="yes"' + a + ">" + (this.cfg.btn ? this.cfg.btn : "\u597d\u7684") + "</div>" : '<div class="lcms-mlayer-alert-btn-bg lcms-mlayer-alert-btn-no" type="no">' + this.cfg.btn[0] + '</div><div class="lcms-mlayer-alert-btn-bg lcms-mlayer-alert-btn-yes" type="yes"' + a + ">" + (this.cfg.btn[1] ? this.cfg.btn[1] : "\u597d\u7684") + "</div>";
        var c = '<div class="lcms-mlayer-bg"></div><div class="lcms-mlayer-alert lcms-mlayer-radius lcms-mlayer-anim-up"><div class="lcms-mlayer-alert-title">' + this.cfg.title + '</div><div class="lcms-mlayer-alert-content">' + this.cfg.content + '</div><div class="lcms-mlayer-alert-btn">' + b + "</div></div>",
            e = '<div class="lcms-mlayer-bg"></div><div class="lcms-mlayer-alert lcms-mlayer-radius lcms-mlayer-anim-up"><div class="lcms-mlayer-alert-content lcms-mlayer-alert-notitle">' + this.cfg.content + '</div><div class="lcms-mlayer-alert-btn">' + b + "</div></div>",
            d = '<div class="lcms-mlayer-msg"><div class="lcms-mlayer-msg-content lcms-mlayer-radius lcms-mlayer-anim-up">' + this.cfg.content + "</div></div>";
        a = '<div class="lcms-mlayer-bg"></div><div class="lcms-mlayer-frame lcms-mlayer-anim-up"><div class="lcms-mlayer-frame-title">' + this.cfg.title + '</div><div class="lcms-mlayer-frame-close"' + a + ">" + (this.cfg.btn ? this.cfg.btn : "\u5173\u95ed") + '</div><div class="lcms-mlayer-frame-content">' + (this.cfg.url ? '<iframe class="lcms-mlayer-frame-content-iframe" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="auto" src="' + this.cfg.url + '"></iframe>' : "<div>" + this.cfg.content + "</div>") + "</div></div>";
        var h = '<div class="lcms-mlayer-bg"></div><div class="lcms-mlayer-loading lcms-mlayer-anim-scale"><div class="lcms-mlayer-anim-loading"></div><div class="lcms-mlayer-loading-content">' + (this.cfg.title ? this.cfg.title : "\u52a0\u8f7d\u4e2d") + "</div></div>",
            l = '<div class="lcms-mlayer-loading lcms-mlayer-anim-scale"><div class="lcms-mlayer-icon lcms-mlayer-icon-success lcms-mlayer-anim-scale"></div><div class="lcms-mlayer-loading-content">' + (this.cfg.title ? this.cfg.title : "success") + "</div></div>",
            m = '<div class="lcms-mlayer-loading lcms-mlayer-anim-scale"><div class="lcms-mlayer-icon lcms-mlayer-icon-error lcms-mlayer-anim-scale"></div><div class="lcms-mlayer-loading-content">' + (this.cfg.title ? this.cfg.title : "error") + "</div></div>";
        b = '<div class="lcms-mlayer-bg"></div><div class="lcms-mlayer-login lcms-mlayer-anim-scale lcms-mlayer-radius"><div class="lcms-mlayer-login-title">' + (this.cfg.title ? this.cfg.title : "\u60a8\u8fd8\u672a\u767b\u9646") + '</div><div class="lcms-mlayer-login-content">' + (this.cfg.content ? this.cfg.content : "\u8bf7\u767b\u9646\u540e\u518d\u8fdb\u884c\u64cd\u4f5c") + '</div><div class="lcms-mlayer-login-icon"><div class="lcms-mlayer-login-icon-eyes"></div><div class="lcms-mlayer-login-icon-mouth"></div></div><div class="lcms-mlayer-alert-btn">' + b + "</div></div>";
        var f = g.createElement("div");
        this.id = f.id = "lcms-mlayer" + k;
        f.setAttribute("class", "lcms-mlayer " + this.cfg.class);
        f.setAttribute("index", k);
        switch (this.cfg.type) {
        case "alert":
            f.innerHTML = "" != this.cfg.title ? c : e;
            break;
        case "msg":
            f.innerHTML = d;
            break;
        case "frame":
            f.innerHTML = a;
            break;
        case "loading":
            f.innerHTML = h;
            break;
        case "success":
            f.innerHTML = l;
            break;
        case "error":
            f.innerHTML = m;
            break;
        case "login":
            f.innerHTML = b
        }
        g.body.appendChild(f);
        c = this.elem = g.querySelectorAll("#" + this.id)[0];
        this.cfg.success && this.cfg.success(c);
        this.index = k++;
        this.action(this.cfg, c)
    };
    d.prototype.action = function (a, b) {
        var c = this;
        a.time && (e.timer[c.index] = setTimeout(function () {
            h.mlayer.close(c.index)
        }, 1E3 * a.time));
        if ("alert" == a.type || "alert_notitle" == a.type || "login" == a.type)
            for (var d = b.getElementsByClassName("lcms-mlayer-alert-btn")[0].children, g = d.length, k = function () {
                    "no" == this.getAttribute("type") ? (a.no && a.no(), h.mlayer.close(c.index)) : a.yes ? a.yes(c.index) : h.mlayer.close(c.index)
                }, l = 0; g > l; l++) e.touch(d[l], k);
        else "frame" == a.type && (d = b.getElementsByClassName("lcms-mlayer-frame-close")[0], e.touch(d, function () {
            h.mlayer.close(c.index, a.end)
        }));
        1 == a.shadeClose && (d = b.getElementsByClassName("lcms-mlayer-bg")[0], e.touch(d, function () {
            h.mlayer.close(c.index, a.end)
        }));
        a.end && (e.end[c.index] = a.end)
    };
    h.mlayer = {
        v: "1.0.1",
        index: k,
        alert: function (a) {
            a.type = "alert";
            return (new d(a || {})).index
        },
        msg: function (a) {
            a.type = "msg";
            return (new d(a || {})).index
        },
        frame: function (a) {
            a.type = "frame";
            return (new d(a || {})).index
        },
        loading: function (a) {
            a.type = "loading";
            return (new d(a || {})).index
        },
        success: function (a) {
            a.type = "success";
            return (new d(a || {})).index
        },
        error: function (a) {
            a.type = "error";
            return (new d(a || {})).index
        },
        login: function (a) {
            a.type = "login";
            return (new d(a || {})).index
        },
        close: function (a) {
            var b = g.querySelectorAll("#lcms-mlayer" + a)[0];
            b.style.cssText = "transition:all .3s; opacity:0";
            setTimeout(function () {
                b && (b.innerHTML = "", g.body.removeChild(b), clearTimeout(e.timer[a]), delete e.timer[a], "function" == typeof e.end[a] && e.end[a](), delete e.end[a])
            }, 500)
        },
        closeAll: function () {
            for (var a = g.getElementsByClassName("lcms-mlayer"), b = a.length, c = 0; b > c; c++) h.mlayer.close(0 | a[0].getAttribute("index"))
        }
    };
    "function" == typeof define ? define(function () {
        return mlayer
    }) : function () {
        var a = g.createElement("style");
        a.type = "text/css";
        a.innerHTML = '.lcms-mlayer{margin:0;padding:0;position:relative;z-index:20000000}.lcms-mlayer *{margin:0;padding:0;font-family:"PingFang SC",Arial,"Segoe UI","Lucida Grande",Helvetica,Arial,"Microsoft YaHei",FreeSans,Arimo,"Droid Sans","wenquanyi micro hei","Hiragino Sans GB","Hiragino Sans GB W3",FontAwesome,sans-serif;-webkit-overflow-scrolling:touch;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:.2s;animation-duration:.2s}@keyframes lcms-mlayer-anim-scale{0%{opacity:0;-webkit-transform:scale(.5);transform:scale(.5)}100%{opacity:1;-webkit-transform:scale(1);transform:scale(1)}}.lcms-mlayer-anim-scale{animation-name:lcms-mlayer-anim-scale;-webkit-animation-name:lcms-mlayer-anim-scale;animation-duration:.2s}@keyframes lcms-mlayer-anim-up{0%{opacity:0;-webkit-transform:translateY(800px);transform:translateY(800px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}.lcms-mlayer-anim-up{-webkit-animation-name:lcms-mlayer-anim-up;animation-name:lcms-mlayer-anim-up;animation-duration:.2s}.lcms-mlayer-radius{border-radius:20px}.lcms-mlayer-bg{position:fixed;width:100%;height:100%;top:0;left:0;background-color:rgba(0,0,0,.5)}.lcms-mlayer-alert{position:fixed;width:90%;margin:0 5%;bottom:20px;background-color:#fff}.lcms-mlayer-alert-title{color:#000;padding:15px 20px 0 20px;font-size:20px;font-weight:600}.lcms-mlayer-alert-content{color:#000;padding:10px 20px 0 20px;font-size:16px;font-weight:400}.lcms-mlayer-alert-notitle{padding:25px 20px 0 20px;text-align:center}.lcms-mlayer-alert-btn{font-size:16px;text-align:center;padding:20px 0;font-weight:400;display:flex;justify-content:space-around}.lcms-mlayer-alert-btn-no{color:#adadad;width:100%;border-right:1px #e4e4e4 solid}.lcms-mlayer-alert-btn-yes{color:#2196f3;width:100%}.lcms-mlayer-msg{position:fixed;width:100%;bottom:100px;text-align:center}.lcms-mlayer-msg-content{display:inline-block;padding:5px 20px;min-width:40%;max-width:90%;font-size:16px;background-color:rgba(0,0,0,.8);color:#fff}.lcms-mlayer-frame{position:fixed;width:100%;height:80%;padding-top:51px;bottom:0;background-color:#f4f4f4;border-radius:20px 20px 0 0}.lcms-mlayer-frame-title{position:absolute;color:#000;top:0;padding:0 5%;font-size:18px;font-weight:600;width:90%;height:50px;line-height:50px;border-bottom:1px #e4e4e4 solid;background-color:#fff;border-radius:20px 20px 0 0}.lcms-mlayer-frame-close{position:absolute;right:0;top:0;color:#2196f3;padding:0 5%;font-size:18px;font-weight:400;height:50px;line-height:50px}.lcms-mlayer-frame-content{position:relative;width:100%;color:#000;height:100%;overflow-x:hidden;overflow-y:auto}.lcms-mlayer-frame-content-iframe{width:100%;height:100%}.lcms-mlayer-loading{position:fixed;width:120px;height:120px;background-color:#fff;margin:-60px 0 0 -60px;top:50%;left:50%;border-radius:10px;text-align:center;box-shadow:0 0 5px 0 rgba(0,0,0,.1)}.lcms-mlayer-loading-content{color:#000;padding-top:15px;font-size:16px}.lcms-mlayer-anim-loading{position:relative;margin:20px auto 0 auto;width:50px;height:50px;transform:rotate(165deg)}.lcms-mlayer-anim-loading:after,.lcms-mlayer-anim-loading:before{content:"";position:absolute;top:50%;left:50%;display:block;width:10px;height:10px;border-radius:.25em;transform:translate(-50%,-50%)}.lcms-mlayer-anim-loading:before{animation:before 2s infinite}.lcms-mlayer-anim-loading:after{animation:after 2s infinite}@keyframes before{0%{width:5px;box-shadow:20px -5px rgba(225,20,98,.75),-20px 5px rgba(111,202,220,.75)}35%{width:30px;box-shadow:0 -5px rgba(225,20,98,.75),0 5px rgba(111,202,220,.75)}70%{width:5px;box-shadow:-20px -5px rgba(225,20,98,.75),20px 5px rgba(111,202,220,.75)}100%{box-shadow:20px -5px rgba(225,20,98,.75),-20px 5px rgba(111,202,220,.75)}}@keyframes after{0%{height:5px;box-shadow:5px 20px rgba(61,184,143,.75),-5px -20px rgba(233,169,32,.75)}35%{height:30px;box-shadow:5px 0 rgba(61,184,143,.75),-5px 0 rgba(233,169,32,.75)}70%{height:5px;box-shadow:5px -20px rgba(61,184,143,.75),-5px 20px rgba(233,169,32,.75)}100%{box-shadow:5px 20px rgba(61,184,143,.75),-5px -20px rgba(233,169,32,.75)}}.lcms-mlayer-icon{position:relative;margin:25px auto 0 auto;height:40px;width:40px;display:block}.lcms-mlayer-icon-success{border-radius:50px;-webkit-border-radius:50px;-moz-border-radius:50px;background:#8bc34a}.lcms-mlayer-icon-success:after,.lcms-mlayer-icon-success:before{content:"";height:28px;width:6px;display:block;background:#fff;position:absolute;top:6px;left:20px;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);-ms-transform:rotate(45deg)}.lcms-mlayer-icon-success:before{height:12px;transform:rotate(-45deg);-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);-ms-transform:rotate(-45deg);top:18px;left:8px}.lcms-mlayer-icon-error{border-radius:50px;-webkit-border-radius:50px;-moz-border-radius:50px;background:#f44336}.lcms-mlayer-icon-error:after,.lcms-mlayer-icon-error:before{content:"";height:6px;width:28px;display:block;background:#fff;border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;position:absolute;top:17px;left:6px;transform:rotate(-45deg);-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);-ms-transform:rotate(-45deg)}.lcms-mlayer-icon-error:after{transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);-ms-transform:rotate(45deg)}.lcms-mlayer-login{position:fixed;width:300px;height:auto;top:50%;left:50%;margin:-150px 0 0 -150px;background:#fff}.lcms-mlayer-login-title{font-size:20px;text-align:center;padding:30px 0 0 0}.lcms-mlayer-login-content{font-size:16px;text-align:center;padding:10px 0 0 0;color:grey}.lcms-mlayer-login-icon{width:100px;height:100px;border-radius:50%;background:#cecece;position:relative;margin:20px auto 0 auto}.lcms-mlayer-login-icon-eyes{position:absolute;width:50px;left:50%;top:35px;margin-left:-25px}.lcms-mlayer-login-icon-mouth{position:absolute;left:50%;top:70%;transform:translate(-50%,-50%);border-top:6px solid #fff;border-right:6px solid transparent;border-left:6px solid transparent;border-bottom:8px solid transparent;width:25px;height:10px;border-top-right-radius:1999px;border-top-left-radius:1999px}.lcms-mlayer-login-icon-eyes::after,.lcms-mlayer-login-icon-eyes::before{content:"";background:#fff;width:10px;height:10px;border-radius:50%;animation:blinkeyes 3s ease-in-out infinite 1s}.lcms-mlayer-login-icon-eyes::before{float:left}.lcms-mlayer-login-icon-eyes::after{float:right;left:100px;top:50px}@keyframes blinkeyes{0%{transform:scaleY(1)}97%{transform:scaleY(1)}100%{transform:scaleY(0)}}';
        g.head.appendChild(a)
    }()
}(window);